package finalproject.mobapp.Main;

import java.io.InputStream;

import finalproject.mobapp.R;
import finalproject.mobapp.HttpRequestController.CustomHttpClient;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;

public class ImageShowActivity extends Activity {
	String uri = null;
	ImageView imageView;
	
	/** Called when the activity is first created. */	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_imageshow);
		
		Bundle extras = getIntent().getExtras();
        if (extras!=null) {
        	uri = extras.getString("uri");
        } else {
        }
		
        //uri = "http://192.168.119.1/MyWebApp/res/1/file2.png";
        InputStream is = CustomHttpClient.downloadFile(uri);
		Bitmap image = BitmapFactory.decodeStream(is);
		
		imageView = (ImageView) findViewById(R.id.imview);
		imageView.setImageBitmap(image);
	}
}
